package JasPerl::TagExt::TagLibrary;

use strict;
use warnings;

my %TAGLIBS = ( );

sub import {
    my ($class, $uri) = @_;
    $uri = $class->URI unless defined $uri;
    $TAGLIBS{$uri} = $class if $uri;
}

sub URI {
    no strict qw(refs);
    return ${"${_[0]}::URI"};
}

sub TAGS {
    no strict qw(refs);
    return %{"${_[0]}::TAGS"};
}

sub taglib {
    my ($class, $uri) = @_;
    return $TAGLIBS{$uri};
}

sub tags {
    return { $_[0]->TAGS };
}

sub tag {
    my $self = shift;
    my $tag = shift;
    return $self->tags()->{$tag};
}

1;
